

void UI_ImageOptions::destroy() {
    PF_SETTINGS->beginGroup("/Image");
    PF_SETTINGS->writeEntry("/ImageAngle", leAngle->text());
    PF_SETTINGS->writeEntry("/ImageFactor", leFactor->text());
    PF_SETTINGS->endGroup();
}

void UI_ImageOptions::setAction(PF_ActionInterface* a, bool update) {
    if (a!=NULL && a->rtti()==LX_Define::ActionDrawImage) {
        action = (WF_DrawImage*)a;

        QString sAngle;
        QString sFactor;
        if (update) {
            sAngle = QString("%1").arg(PF_Math::rad2deg(action->getAngle()));
            sFactor = QString("%1").arg(action->getFactor());
        } else {
            PF_SETTINGS->beginGroup("/Image");
            sAngle = PF_SETTINGS->readEntry("/ImageAngle", "0.0");
            sFactor = PF_SETTINGS->readEntry("/ImageFactor", "1.0");
            PF_SETTINGS->endGroup();
        }
	leAngle->setText(sAngle);
	leFactor->setText(sFactor);
        updateData();
    } else {
        PF_DEBUG->print(PF_Debug::D_ERROR, 
			"UI_ImageOptions::setAction: wrong action type");
        action = NULL;
    }
}

void UI_ImageOptions::updateData() {
    if (action!=NULL) {
        action->setAngle(PF_Math::deg2rad(PF_Math::eval(leAngle->text())));
        action->setFactor(PF_Math::eval(leFactor->text()));
    }
}
